BarUpDn time limitedtrying to understand strategies, it appears that there is a lot of black magic in how a strat works behind the scenes.
anyway, it's hard to analyse what's all the data with one gazillion entries, and i wanted to know how we can manipulate/do stuff with a chart.
so, i needed to know how to "give" the script my values to work on. bundled two wants/needs into one, and created a script that only applies a strategy from the date given onwards.
how to use:
at the chart, go to the "format" little button, then the input tab, and there is all the date fields i created. fun to set it to the current date, then start going backwards and see all the little arrows filing up the chart :)
Search in scripts for "the script"
Smart Money Liquidity Structure AlgoSmart Money Liquidity Structure Algo is a rule-based trading strategy designed to analyze market structure, liquidity zones, and volatility conditions.
The script combines structure breakout logic, volatility filtering, order-block style price gaps, and Supertrend direction to generate systematic long and short signals.
This strategy is intended for educational and research purposes, helping traders study how liquidity, structure, and trend alignment can be combined into a single framework.
All signals are generated objectively using predefined conditions without repainting after bar close.
The strategy includes built-in risk management logic using ATR-based stop-loss and trailing exit mechanisms.
⚙️ Core Logic Overview
Market structure based on pivot-derived support and resistance
Volatility normalization filter to avoid low-activity periods
Price gap detection inspired by order-block concepts
Supertrend-based directional confirmation
Time-based holding logic before exits are allowed
✨ Features
Rule-based long and short entries
Liquidity & structure breakout detection
Volatility-filtered signal generation
Optional Supertrend trend filter
ATR-based stop-loss and trailing exits
Non-repainting logic after candle close
🧪 How to Use
Apply on liquid markets such as crypto, indices, or forex
Works best on intraday to higher timeframes
Adjust volatility filter and ATR multiplier based on the instrument
Always forward-test and paper-trade before live use
⚠️ Disclaimer
This script is not financial advice.
Trading involves risk, and past performance does not guarantee future results.
Use this strategy for analysis, testing, and educational purposes only.
EMA + RSI Forex StrategyHere is a complete and ready-to-use Pine Strategy Script v5 trading strategy. It’s designed for forex pairs and uses combination of EMA crossover and RSI confirmation to identify high-probability entries. The script includes backtesting capability and adjustable parameters for optimization.
Kev's RSI2 SMA50 Strategy⭐ Kev’s RSI2 SMA50 Strategy — Institutional Edition (TSX Optimized + RR Filter)
A professional swing-trading system based on Larry Connors’ RSI(2) mean-reversion framework, optimized for TSX equities. Designed for Daily timeframe trading with institutional trend alignment, volatility filtering, and strict risk-reward controls.
📌 Overview
This strategy enhances the classic RSI(2) setup with:
• Strong trend confirmation (SMA50 + Weekly SMA50)
• Deep pullback detection (RSI2 < 3)
• Structural swing-based stop-loss
• Fixed 2R profit target (non-repainting)
• Optional Connors RSI (CRSI) confirmation
• Volatility filtering via ATR range
• Mechanical, deterministic, no-discretion rules
Works best on TSX large & mid-caps, ETFs, and liquid equities.
🔍 Core Philosophy
Buy strong stocks on pullbacks → Price must be above SMA50 + Weekly SMA50.
Pullback must be statistically meaningful → RSI(2) < 3.
R:R must justify the trade → Swing-low SL + 2R target with structural room to hit TP.
🧠 Entry Conditions (Non-Repainting)
• RSI(2) < 3 → Identifies extreme short-term oversold dips.
• SMA50 Filter → Ensures uptrend alignment.
• Weekly HTF Filter (Default = 1W) → Confirms broader trend direction.
• ATR Filter → Rejects volatile bars (range < ATR(14) × 2.2).
• Optional:
– SMA50 Slope (positive trend strength)
– Bullish Reversal Candle
– Connors RSI < 20 (deep pullback confirmation)
🎯 Risk Management
All levels are locked at entry and never repaint.
• Swing-Low SL (last 5 bars)
• 2R Profit Target = Entry + (Risk × 2)
• R:R Feasibility Filter → Only enters if recent swing high is above TP.
• Optional RSI Exit → Exit when RSI2 > 90 (enabled by default).
• Optional SMA Exit (disabled by default) → Conservative early exit.
📈 Visuals
The script plots:
• SMA50
• Weekly SMA50
• Swing-Low SL (fixed)
• 2R TP (fixed)
• Optional SMA exit line
All are non-repainting and update only on confirmed bars.
🔔 Alerts
Buy Signal → All entry filters aligned (RSI2, SMA50, HTF, ATR, RR check).
Exit Signal → 2R hit, SL hit, RSI exit, or SMA exit (if enabled).
🧭 Recommended Usage
• Timeframe: Daily
• HTF: Weekly (default)
• Best For: TSX equities, mid/large-cap stocks, ETFs
• Style: Short-term swing trading (1–10 bars)
• Avoid: Low-volume tickers, microcaps, crypto, biotech, news-driven spikes.
🛑 Notes
• All HTF data uses lookahead_off → non-repainting.
• Rules are fully mechanical and deterministic.
• Position sizing uses % equity by default.
• This script is for educational purposes only and not financial advice.
• Always forward-test before using live capital.
Composite PR Signal (Trend↔Revert + ADX gate)Core Components
1. Dynamic Inputs
Max/PR windows (maxLen, prWin) – define historical lookbacks for oscillators and percentile ranks.
Smoothing (smooth) – applies an EMA filter to stabilize composite scores.
Threshold (th) – governs entry sensitivity.
Holding period (hBars) – maximum bars allowed in a trade.
Execution options – allow shorting, fast approximations for PR and CCI.
2. Custom Utility Functions
The script implements optimized versions of common TA operations:
Rolling sums, delays, and moving averages (EMA, RMA, SMA).
Lazy rolling extrema (efficient highest/lowest lookups).
Stateful arrays for tracking oscillator values across bars.
Fast approximations for percentile ranks and indicators.
3. Indicators Used
The system calculates a broad set of oscillators, including:
Trend/Momentum: ROC, TRIX, TSI, MACD histogram, OBV ROC, AO, CMF, BOP, UO, ADX.
Reversion/Oscillators: RSI, Stochastic K/D, MFI, Williams %R, CCI, CMO.
Each is converted into a percentile rank (PR) to normalize values between 0–100.
4. Composite Scoring
Two composite signals are built:
Trend Score – averages normalized outputs of momentum indicators.
Reversion Score – averages normalized outputs of oscillators prone to mean reversion.
ADX Gate – when ADX PR is high, the strategy favors trend score; when low, it favors reversion score.
Final score is smoothed and compared against entry thresholds.
5. Trade Logic
Entry:
Long: When composite score crosses above +th.
Short: When composite score crosses below -th (if enabled).
Exit:
Opposite crossover signal.
Or trade duration exceeds hBars.
6. Risk/Execution Parameters
Initial capital: 100,000
Commission: 0.01% per trade
Fixed order size: 100 units
No pyramiding
Intended Use
This script is designed for:
Swing trading across multiple assets (equities, forex, crypto).
Adapting to market regimes — capturing breakouts during strong trends, but fading moves when markets are choppy.
Parabolic SAR Strategy with MACD Confirmation & Trend Zone Highl📝 Description (SEO + Follower-Friendly):
🚀 Powerful Trend Strategy Using Parabolic SAR + MACD
This advanced Pine Script combines the classic Parabolic SAR trend-following system with MACD crossover confirmation, improving entry precision and filtering out false signals. The script also features:
✅ Dynamic trend zone background highlighting when SAR is below price
✅ MACD filter ensures trades align with market momentum
✅ Custom SAR logic with adaptive acceleration
✅ Clean visual SAR plots for easy trend tracking
✅ Fully backtestable with strategy.entry logic
🔎 Ideal for traders seeking early trend entries, momentum confirmation, and visual clarity.
📈 Works on all timeframes and pairs — perfect for swing traders, scalpers, and crypto enthusiasts.
💡 Use it as a base strategy or combine with your favorite indicators.
❤️ If you find this helpful, don't forget to like, comment, and follow for more premium strategies!
Backtest [OptAlgo]This backtest script is designed to convert ideas or indicators into backtest results. The script creates buy/sell signals by comparing price sources against fixed values or other imported plots using many comparison methods. It has many features including multiple exit systems: TP/SL, custom plot-based stops and more. It supports full trading automation through webhook alerts with live signal processing.
🔢 Signal Creation System
→ Values Group : Compare price sources against fixed numerical values
→ Plots Group : Compare two different price sources/indicators against each other
→ Flexible Comparisons : 15+ comparison methods (equal, crossover, rising...)
→ Signal Types : Long, Short, Close All, Block signals, and combination signals
→ Merge Rules : Minimum condition requirements for signal activation
🔀 Advanced Signal Logic
→ Counter Signals : Choose between reversing positions or closing them
→ Signal Inversion : Flip all buy/sell signals with one toggle
→ External Signal Import : Import coded signals (1=Long, -1=Short, 0=Close)
→ Day Blocker : Enable/disable trading on specific weekdays
→ Session Control : Limit trading to specific market sessions
⚙️ Strategy Settings
→ Position Sides : All Ways, Long Only, or Short Only modes
→ Signal Control : Individual enable/disable for long and short signals
→ Counter Signal Mode : Reverse Open Position vs Close Open Position
→ Signal Reversal : Global signal inversion capability
🔰 Risk Management (Limiter Settings)
→ Leverage Control : Leverage with liquidation warnings
→ Drawdown Limit : Auto-halt strategy at specified drawdown percentage
→ Tradable Ratio : Use portion of available balance (0.01-1.0)
→ Contract Limit : Cap maximum contract size regardless of balance
🎯 TP/SL System
→ Fixed TP/SL : Set percentage-based take profit and stop loss
→ Custom Plot Stops : Use any indicator/plot as dynamic stop loss
→ ATR-Based Exits : Volatility-adjusted TP/SL using Average True Range
→ Realistic Protection : Prevents unrealistic TP/SL prices in live trading
→ Stop Modes : Instant (Sudden) vs Candle Close execution
→ ATR Stop Loss : Override fixed SL with volatility-based calculations
→ ATR Take Profit : Dynamic TP based on market volatility
→ Trailing Options : Safe, Normal, or Aggressive trailing methods
→ Calculation Modes : Normal, Volume-weighted, or Limited (with max %) options
→ Volume Integration : ATR levels adjust based on volume influx
🤖 Automation & Alerts
→ Webhook Integration : Send JSON alerts for automated execution
→ Live Signals : Real-time signal processing (every tick vs bar close)
→ Strategy Key : Unique identifier for automated systems
→ Early Entry : Send alerts X seconds before candle close
→ Fast Execution : Prevent signal lag in automated trading
🐞 Development Tools
→ Alert Plotting : Visualize signals directly on chart (disable for live alerts)
→ Professional Mode : Remove UI controls for faster calculation
→ Debug : Metrics are plotted in data window.
📊 Key Advantages
→ Multi-Condition Logic : Combine multiple indicators with flexible rules
→ Risk-First Design : Built-in drawdown and leverage protection
→ Automation Ready : Full webhook and alert system integration
⚠️ Important Warnings
→ High leverage combined with high SL may adjust to liquidation price
→ Use consistent leverage across all strategies on same trading isolated margin pair
→ Live signals require "Calculate on every tick" enabled in settings
→ Disable alert plotting when creating actual alerts to prevent latency
SPXL Futures Strategy- Buy/sell signals for SPXL using futures momentum.
- For real-time signals at close, use ES1! on 2 minute chart and sign up for real-time cboe mini futures data feed in tradingview.
- All buys and sells are at near close of US RTH market at 4pm.
- Best to use the script with other breadth signals to decide on trading strategy.
- Script is compatible with SPY, SPXL, RSP, QQQ, TQQQ and many other SPX correlated tickers, however it’s primarily developed for SPX.
VGrego - Triple Regression StrategyI developed this strategy with perpetual contracts like the ones offered by Bitmex and FTX for Bitcoin.
This script uses complex regressions to analyze past, present and future to place long calls.
The script performs well on 1H charts on most perpetual contracts scenario.
VWAP Bands BacktestThis is a backtest for evaluating the profitability of a vwap offsets strategy over time.
I took part of the code to create the script from Noro
So there is a link for its code
CCI strategy on OIL1HThis indicator is based on Commodity Channel Index.
It buys when CCI on period 200 is under -130 and it´s rising last 12 bars. It closes the position by hitting Take Profit, Stop Loss or opening short position.
It sells when CCI on period 200 is over 130 and it´s falling last 12 bars. It closes the position by hitting Take Profit, Stop Loss or opening short position.
This strategy seems to working just on USOIL on 1 hour chart. This can predict that it´s just luck and not proper strategy or indicator I would use for trading.
This script is just for educational purposes and that´s why the script is open. I will be happy if you will leave comment and try to come up with some ideas how to improve this strategy, so it can be used also on other commodities/forex pairs.
MarketCipher B Backtest (FOR TESTING ONLY, NOT SAFE TO TRADE)A script to backtest the strategy outlined. This is not a final version of the script and is therefore not safe to trade. If you choose to ignore this warning, trade at your own risk.
Ema BacktesterA simple, but useful script for backtesting purposes. Find the optimal Settings for your strategy.
tips are always welcome at: 38uGQJDDZDL6wX48x4gYTccPeQ3ZHVYmY4 (btc)
I hope you enjoy the script :)
Trending CMF MultiTimeFrame - Strategythis is the strategy for the script below
Multi time frame crypto trader
E-Z Hai Cloud v0.01Very Early version of a new script I am working on. Currently setup for one hour but I want it to work well on multiple time frames.
Options for ADX aren't working atm.
Wanting to add take profits and stop losses in the future, as well as the ability for the script to check multiple time frames so it knows to hodl or dump.
Please let me know if you run into any issues.
Bitmex Bot 5m candlesThis script was made for our customers to test the strategies of our Bitmex Bot.
I'm not going to give you permission to use the Script, only if you become our client.
Telegram @rmgslash
BitMex Trailing Stop StrategyThis script is designed for those who want to use BitMex's trailing stop. It's not meant to be used as entry exits, but rather to get an idea of how wide the trailing stop needs to be. I suggest you backtest with different values. The script can also be integrated into an existing strategy which does give entry/exits to act as its stop loss.
VJSHARMA_BB_MACD_Stoch_Short_Trade_Strategy_V2This script has the same working behind it except for some minor tweaks.
These tweaks enable the script to generate more signals than the previous version but with a loss of 4% accuracy.
Updated TurtlesThis script has been updated to prevent double orders (short/long) from occurring and modifying backtests results.
This is an update to the script that was written a few years ago to prevent double longs/shorts from occurring and skewin backtesting results. Check out the updated indicator here and let me know what you think.
I also added:
- date range inputs if you want to do some backtesting on a particular set of dates.
- the ability to toggle shorting
LFH/ Long positions using MACD histogram, long EMA and short EMADisclaimer: I'm a noob.
Hey there!
I'm trying to implement a script which enter market long position when long EMA crossover short EMA and MACD histogram is positive and histogram at T time is lesser than histogram at T-1.
And when short EMA crossover long EMA, plus MACD histogram is negative and histogram at T is greater than histogram at T-1, I want the script to exit market long position.
Now, I have something pretty close to what I am looking for. What I am missing and can't figure out yet is:
How to moderate entries, ie. I would like it to enter positions when trends are really interesting not just every time the conditions are fulfilled (same for exits) as there is way too much positions
I need to find a way to exit appropriated positions.
Another Millionaire toolBack with another Millionaire tool script, put like a solid 12 minutes here curve fitting the moving averages. THIS WILL MAKE YOU A MILLIONAIRE. It is so easy, it makes one of the hardest industries very very easy. Works on any market. I'VE DECIDED TO SHARE THE SCRIPT AND MAKE IT PUBLIC SO WE CAN ALL BE RICH TOGETHER, MILLIONAIRES
Long Bollinger Bands StrategyLong Bollinger Bands Strategy (XAUUSD) — Lower Band Reversal + 4-Step Scaling + Daily DD Guard
Long Bollinger Bands Strategy is a long-only Bollinger Bands reversal/mean-reversion strategy designed mainly for XAUUSD. It looks for a bearish push below the Lower Band followed by a bullish reclaim on candle close, then optionally scales in up to 4 entries (E1–E4) as price pulls back.
1) Risk Management & Position Sizing
The strategy includes a USD-based risk input: Risk per setup (USD).
It automatically calculates position size using the average SL distance across the 4-entry structure, then distributes size across entries with built-in weighting.
BackTest Lot checkbox:
OFF (default): uses normalized sizing (qty divided by 100)
ON: uses raw qty for backtesting workflows
2) SL/TP Management (Locked SL + Optional Range TP)
Stop Loss (SL): based on SL distance (pips from entry) from E1.
Take Profit (TP):
If TP (pips) > 0: fixed pip TP from E1
If TP (pips) = 0: TP is based on the signal candle range (high–low)
SL Lock: once the stop is tightened, it never loosens again (only moves in a protective direction) until the trade closes.
3) Daily Drawdown Protection
Tracks equity by day and stops opening new positions once Max daily drawdown (USD) is reached for that day.
4) Notes / Disclaimer
This strategy does not use volume, RSI, fundamentals, news filters, or session filters. Users should apply discretion and consider confirmations from other tools and market context. Results depend on symbol settings, spread, commission, and volatility regime. Always forward-test before using in live trading.
Designed for XAUUSD. The script uses an internal pip conversion (pipSize = 0.1) consistent with common gold quoting; verify your broker’s pip definition for best alignment.
5) Suggested Usage
Best used during volatile conditions or after a clear lower-band sweep and reclaim.
Consider pairing with trend filters or higher-timeframe bias.
6) Release Notes
Initial release: Long-only BB reclaim logic with 4-step scaling
Added: SL/TP lock logic and visual SL/TP lines
Added: Daily drawdown guard and backtest lot toggle OANDA:XAUUSD
Reversal WaveThis is the type of quantitative system that can get you hated on investment forums, now that the Random Walk Theory is back in fashion. The strategy has simple price action rules, zero over-optimization, and is validated by a historical record of nearly a century on both Gold and the S&P 500 index.
Recommended Markets
SPX (Weekly, Monthly)
SPY (Monthly)
Tesla (Weekly)
XAUUSD (Weekly, Monthly)
NVDA (Weekly, Monthly)
Meta (Weekly, Monthly)
GOOG (Weekly, Monthly)
MSFT (Weekly, Monthly)
AAPL (Weekly, Monthly)
System Rules and Parameters
Total capital: $10,000
We will use 10% of the total capital per trade
Commissions will be 0.1% per trade
Condition 1: Previous Bearish Candle (isPrevBearish) (the closing price was lower than the opening price).
Condition 2: Midpoint of the Body The script calculates the exact midpoint of the body of that previous bearish candle.
• Formula: (Previous Open + Previous Close) / 2.
Condition 3: 50% Recovery (longCondition) The current candle must be bullish (green) and, most importantly, its closing price must be above the midpoint calculated in the previous step.
Once these parameters are met, the system executes a long entry and calculates the exit parameters:
Stop Loss (SL): Placed at the low of the candle that generated the entry signal.
Take Profit (TP): Calculated by projecting the risk distance upward.
• Calculation: Entry Price + (Risk * 1).
Risk:Reward Ratio of 1:1.
About the Profit Factor
In my experience, TradingView calculates profits and losses based on the percentage of movement, which can cause returns to not match expectations. This doesn’t significantly affect trending systems, but it can impact systems with a high win rate and a well-defined risk-reward ratio. It only takes one large entry candle that triggers the SL to translate into a major drop in performance.
For example, you might see a system with a 60% win rate and a 1:1 risk-reward ratio generating losses, even though commissions are under control relative to the number of trades.
My recommendation is to manually calculate the performance of systems with a well-defined risk-reward ratio, assuming you will trade using a fixed amount per trade and limit losses to a fixed percentage.
Remember that, even if candles are larger or smaller in size, we can maintain a fixed loss percentage by using leverage (in cases of low volatility) or reducing the capital at risk (when volatility is high).
Implementing leverage or capital reduction based on volatility is something I haven’t been able to incorporate into the code, but it would undoubtedly improve the system’s performance dramatically, as it would fix a consistent loss percentage per trade, preventing losses from fluctuating with volatility swings.
For example, we can maintain a fixed loss percentage when volatility is low by using the following formula:
Leverage = % of SL you’re willing to risk / % volatility from entry point to exit or SL
And if volatility is high and exceeds the fixed percentage we want to expose per trade (if SL is hit), we could reduce the position size.
For example, imagine we only want to risk 15% per SL on Tesla, where volatility is high and would cause a 23.57% loss. In this case, we subtract 23.57% from 15% (the loss percentage we’re willing to accept per trade), then subtract the result from our usual position size.
23.57% - 15% = 8.57%
Suppose I use $200 per trade.
To calculate 8.57% of $200, simply multiply 200 by 8.57/100. This simple calculation shows that 8.57% equals about $17.14 of the $200. Then subtract that value from $200:
$200 - $17.14 = $182.86
In summary, if we reduced the position size to $182.86 (from the usual $200, where we’re willing to lose 15%), no matter whether Tesla moves up or down 23.57%, we would still only gain or lose 15% of the $200, thus respecting our risk management.
Final Notes
The code is extremely simple, and every step of its development is detailed within it.
If you liked this strategy, which complements very well with others I’ve already published, stay tuned. Best regards.






















